<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="layout.xhtml">
        <ui:define name="body">
            <h3 class="title">Paracelsus - Integração Digital do SUS</h3>
            <hr/>
            <h:form id="agenteForm" enctype="multipart/form-data">
                <br/>
                <h3 class="title"></h3>
                <p:growl id="messages" showDetail="true" autoUpdate="true"  /> 
                <p:panel id="personPanel" style="background: none; border: none;" 
                         styleClass="container_24 clearfix both ">
                    <p:button icon="ui-icon-search" styleClass="ui-priority-primary" href="pesquisarprofissional.xhtml" value="Pesquisar" style="float: right" 
                              />
                    <p:button icon="ui-icon-plus" styleClass="ui-priority-primary" href="criarprofissional.xhtml" value="Adicionar" style="float: right" 
                              />
                    <br/><br/>
                    <h:panelGrid columns="2" style="border: 0px;">
                        <p:column >
                            <p:pieChart  value="#{managerPesquisarProfissional.pieModel}" legendPosition="w"  
                                        showDataLabels="true"  legendCols="2"  dataFormat="value"
                                        title="Quantidade de Profissionais :" style="height:300px; width: 480px;" >
                                <p:ajax event="itemSelect" listener="#{managerPesquisarProfissional.itemSelect}" update="@form" />
                            </p:pieChart>
                        </p:column>
                        <p:column>

                            <p:dataTable id="profissionalTable" var="item" value="#{managerPesquisarProfissional.profissionaisPieModel}" 
                                         styleClass="grid_24" rowIndexVar="rowid"                 
                                         rows="5" paginator="true" lazy="true"   
                                         paginatorTemplate="{FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
                                         currentPageReportTemplate="{currentPage} de {totalPages}"
                                         paginatorPosition="bottom" emptyMessage="Nenhum registro encontrado"
                                         style="white-space: pre-wrap;">

                                <f:facet name="header">
                                    <p:outputLabel value="Profissional" />
                                </f:facet> 
                                <p:column headerText="Ação" width="100">
                                    <p:button title="Editar"
                                              href="editarprofissional.xhtml?editarProfissional=#{item.id}"
                                              icon="ui-icon-pencil"/>
                                    <p:button title="Visualizar"
                                              href="visualizarprofissional.xhtml?visualizarProfissional=#{item.id}"
                                              icon="ui-icon-zoomin"/> 
                                </p:column>

                                <p:column headerText="Nome" width="400">  
                                    <h:outputText value="#{item.nome}" />

                                </p:column>
                              

                            </p:dataTable>
                        </p:column>
                    </h:panelGrid>
                </p:panel>


            </h:form>
        </ui:define>
    </ui:composition>

</html>
